<%@ page contentType="text/html; charset=UTF-8"  %>
<%@ include file="/common/meta.jsp" %>
<%@ include file="/common/import.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title>外部系统注册</title>
<script type="text/javascript" src="${ctx}/js/zbxtools.js"></script>
<script type="text/javascript" src="${ctx}/js/easyui/zbx-ui-validate.js"></script>
<script type="text/javascript">
	var inputForm = '#inputForm';
	$(function(){
	var sysOwtype= '${item.sysOwtype}';
	if(sysOwtype==1){
		showTab();
	}else{
		hideTab();
	}
	
		
	//执行保存操作
		$(inputForm).form({
		    success:function(data){
		    	var result = jQuery.parseJSON(data);
		    	if(result.flag=='T'){
		    		$.messager.alert('提交结果', result.msg, 'info',function(){
		    			parent.colseAdd();// 关闭添加窗口
		    			parent.sysReload();// 刷新列表
		    		});
		    	}else{
		    		$.messager.alert('提交结果', result.msg, 'error');
		    	}        
		    },
		    error:function(messg)  { 
	       	    $.messager.alert('错误提示', '与服务器连接异常', 'error');
	       }  
		});
	});
	
	//执行表单提交操作
	function doSubmit(){
		var flag = $(inputForm).form('validate');
		if(flag){
			$(inputForm).submit();
		}
	}
	//外部系统弹出添加框
	function outSide(type){
		if(type==1){
			showTab();	
		}else{
			hideTab();	
		}
	}
	
	
	function hideTab(){
		$("#syxy").hide();
		$("#fwdz").hide();
		$("#dk").hide();
		$("#cslb").hide();
	}
	
	function showTab(){
		$("#syxy").show();
		$("#fwdz").show();
		$("#dk").show();
		$("#cslb").show();
	}
</script>
</head>
<body>	
<div id="tip"> </div>
		<form id="inputForm" name="inputForm" method="post" action="${ctx}/passport/ssosys/save.action">
			<input type="hidden" name="sysId" id="sysId" value="${item.sysId}"/>
			<input type="hidden" name="synId" id=synId value="${item2.synId}"/>
			<input type="hidden" name="isAdd" id="isAdd" value="${isAdd}"/>
			<table class="datagrid-body" style="font-size: 12px;">
			<tr>
				<td class="datagrid-header">系统英文名称<font color=red>*</font></td>
				<td>
					<input id="sysEname" name="sysEname" value="${item.sysEname}"  <%if(request.getAttribute("item")!=null){ %> readonly="readonly" <%}%>
					class="easyui-validatebox" data-options="required:true" size="20"
					missingMessage="请输入系统英文名称"  />
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">系统中文名称<font color=red>*</font></td>
				<td>
					<input name="sysCname" id="sysCname" value="${item.sysCname}"
					class="easyui-validatebox" data-options="required:true" size="20"
					missingMessage="请输入系统中文名称"/>				
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">可访问系统IP<font color=red>*</font></td>
				<td>
					<input name="sysAccreditip" id="sysAccreditip" value="${item.sysAccreditip}"
					class="easyui-validatebox" data-options="required:true" size="30"
					missingMessage="请输入外部系统IP" />				
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">内外部系统标示<font color=red>*</font></td>
				<td>
					<input type="radio" name="sysOwtype" id="sysOwtype_1" value="0" checked="checked" onclick="outSide(0)"/>内部
					<input type="radio" name="sysOwtype"  id="sysOwtype_0" value="1" onclick="outSide(1)"/>外部
				</td>
			</tr>
			
			
					<tr id="syxy" style="background-color: #008B00">
					   <td class="datagrid-header">使用协议<font color=red>*</font></td>
						<td>
						    <select name="synUseAgree" id="synUseAgree" style="width:300px">
							   <option value="">--请选择--</option>
							   <option value="http">HTTP协议</option>
							   <option value="https">HTTPS协议</option>
							   <option value="socket">SOCKET协议</option>
							   <option value="webservice">WEBSERVICE协议</option>
							   <option value="internal">内部</option>
							</select>
						</td>
					</tr>
					<tr id="fwdz" style="background-color: #008B00">
						<td class="datagrid-header">服务地址<font color=red>*</font></td>
						<td>
							<input name="synSeraddr" id="synSeraddr" value="${item2.synSeraddr}"
							class="easyui-validatebox" data-options="required:false" size="38"
							missingMessage="请输入服务地址" invalidMessage="" />				
						</td>
					</tr>
					<tr id="dk" style="background-color: #008B00">
						<td class="datagrid-header">socket端口</td>
						<td>
							<input id="synSockport" name="synSockport"  value="${item2.synSockport}"
							class="easyui-validatebox" data-options="required:false" size="38" />
						</td>
					</tr>
					<tr id="cslb" style="background-color: #008B00">
						<td class="datagrid-header">参数列表</td>
						<td>
							<input id="synParamet" name="synParamet"  value="${item2.synParamet}"
							class="easyui-validatebox" data-options="required:false" size="38" alt="11" title="可供选择:userId;userEname;userCname;userPass;userStatus;email;mobile;regIp;createTime;"/>
						</td>
					</tr>
					
					
			
			
			<tr>
				<td class="datagrid-header">状态<font color=red>*</font></td>
				<td>
					<input type="radio" name="sysStatus" id="sysStatus_1" value="0" checked="checked"/>启用
					<input type="radio" name="sysStatus"  id="sysStatus_0" value="1" />冻结
				</td>
			</tr>	
			<tr >
				<td class="datagrid-header">备注</td>
				<td>
					<textarea name="sysRemark" id="sysRemark" class="easyui-validatebox"  size="40"
					cols="40" rows="4"
					 >${item.sysRemark}</textarea>				
				</td>
			</tr>
			<tr>
				<td class="datagrid-header"></td>
				<td >	
					<a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save" onclick="doSubmit();">提交</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="parent.colseAdd();"; >取消</a>	
				</td>
			</tr>
			</table>
		</form>
</body>
</html>
<script>
	ZBXTools.initRadio("sysStatus","${item.sysStatus}");
	ZBXTools.initRadio("sysOwtype","${item.sysOwtype}");
	ZBXTools.initSelect("synUseAgree","${item2.synUseAgree}");
</script>